package limeirafol.gui;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultDesktopManager;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;
import limeirafol.Global;
import limeirafol.avisos.gui.AvisoGUI;
import limeirafol.gui.financeiro.ContasPagarCadastroGUI;
import limeirafol.gui.Cadastro.AcessorioCadastroFotoGUI;
import limeirafol.gui.Cadastro.AcessorioConsultaGUI;
import limeirafol.gui.Cadastro.BanhoConsultaGUI;
import limeirafol.gui.Cadastro.FornecedorConsultaGUI;
import limeirafol.gui.Cadastro.MunicipioConsultaGUI;
import limeirafol.gui.Cadastro.ProdutoConsultaGUI;
import limeirafol.gui.estoque.EstoqueAcessorioConsultaGUI;
import lbframework.bean.internalFrame.LBInternalFrame;
import lbframework.bean.mdiFrame.LBMdiFrame;
import lbframework.classe.Util;
import lbframework.remote.Arquivo;
import limeirafol.bean.BeanFinanceiro;
import limeirafol.gui.Cadastro.ClienteConsultaGUI;
import limeirafol.gui.Cadastro.UsuarioConsultaGUI;
import limeirafol.gui.administracao.AdministracaoPrecoGUI;
import limeirafol.gui.financeiro.ChequesRecebidosConsultaGUI;
import limeirafol.gui.sistema.EmailConfiguracaoGUI;
import limeirafol.gui.sistema.SenhaCadastroGUI;
import limeirafol.gui.venda.OrdemServicoConsultaGUI;
import limeirafol.gui.venda.PedidoConsultaGUI;
import limeirafol.remote.financeiro.ChequesRecebidosVO;

public class MenuGUI extends LBMdiFrame {

    private AvisoGUI avisos = null;
    private LoginGUI loginFrame = null;
    public FornecedorConsultaGUI formFornecedorConsulta = null;
    public MunicipioConsultaGUI formMunicipioConsulta = null;
    public AcessorioConsultaGUI formAcessorioConsulta = null;
    public EstoqueAcessorioConsultaGUI formEstoqueAcessorioConsulta = null;
    public AcessorioCadastroFotoGUI formAcessorioCadastroFoto = null;
    public BanhoConsultaGUI formBanhoConsulta = null;
    public ProdutoConsultaGUI formProdutoConsulta = null;
    public ContasPagarCadastroGUI formContasPagarCadastro = null;
    public ParametroGUI formParametro = null;
    public ChequesRecebidosConsultaGUI formChequesRecebidosConsulta = null;
    public UsuarioConsultaGUI formUsuarioConsulta = null;
    public SenhaCadastroGUI formSenhaCadastro = null;
    public ClienteConsultaGUI formClienteConsulta = null;
    public AdministracaoPrecoGUI formAdministracaoPreco = null;
    public PedidoConsultaGUI formPedidoConsulta = null;
    public EmailConfiguracaoGUI formEmailConfiguracao = null;
    public OrdemServicoConsultaGUI formOrdemServicoConsulta = null;
    private boolean alteracotacao = false;
    private BeanFinanceiro beanFinanceiro = new BeanFinanceiro();
    private ChequesRecebidosVO oCheque = new ChequesRecebidosVO();

    public MenuGUI(LoginGUI i_loginFrame) throws Exception {
        initComponents();

        setExtendedState(LBMdiFrame.MAXIMIZED_BOTH);

        if (!(Global.consultaDataProcessamento().equals(Util.formatDataBanco(Util.getDataAtual())))) {
            Global.atualizaDataProcessamento(Util.formatDataBanco(Util.getDataAtual()));
            alteracotacao = true;
        }

        desktopPane = lbDesktopPane;
        desktopPane.setDesktopManager(new DefaultDesktopManager());
        loginFrame = i_loginFrame;
        setMnuJanela(mnuJanela);

        atualizarJanela();

        if (alteracotacao) {
            atualizaCotacoes();
        }
        //ALTERAR DEPOIS
        //     mnuFinanceiro.setVisible(false);
    }

    public void atualizaCotacoes() throws Exception {
        try {
            if (formParametro == null || formParametro.isClosed()) {
                formParametro = new ParametroGUI(this);
            }

            formParametro.setCotacao(true);
            formParametro.carregarParametro(5);
            formParametro.setTitle("Atualizar Cotações");
            formParametro.setVisible(true);
            formParametro.setCentralizarForm();

        } catch (Exception e) {
        }
    }

    @Override
    public void atualizarJanela() throws Exception {
        if (mnuJanela == null) {
            return;
        }
        //verifica janela selecionada
        LBInternalFrame oInternalFrame = null;

        for (int i = 0; i < this.desktopPane.getComponentCount(); i++) {
            Component oComponente = this.desktopPane.getComponent(i);

            if (oComponente instanceof LBInternalFrame) {
                oInternalFrame = (LBInternalFrame) oComponente;

                if (oInternalFrame.isSelected()) {
                    break;
                }
            }
        }

        //recria menu janela
        mnuJanela.removeAll();

        for (int i = 0; i < vJanela.size(); i++) {
            LBInternalFrame oJanela = vJanela.get(i);

            JCheckBoxMenuItem mnuItem = new JCheckBoxMenuItem(oJanela.getTitle());
            mnuJanela.add(mnuItem);

            if (oJanela.equals(oInternalFrame)) {
                mnuItem.setSelected(true);
            }

            mnuItem.setActionCommand(String.valueOf(i));

            mnuItem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        int i = Integer.parseInt(e.getActionCommand());
                        vJanela.get(i).setSelected(true);

                        ((JCheckBoxMenuItem) e.getSource()).setSelected(true);

                    } catch (Exception ex) {
                    }
                }
            });
        }

        //resetar janela
        if (vJanela.size() > 0) {
            mnuJanela.add(new JSeparator());
        }

        JMenuItem mnuResetarJanela = new JMenuItem("Resetar Janelas");
        mnuJanela.add(mnuResetarJanela);

        mnuResetarJanela.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    Util.exibirMensagemContinuar("Todas as janelas voltarão ao seu formato padrão!", getTitle());

                    Arquivo arq = new Arquivo(Util.getRoot() + Util.FILE_LOG_GUI, "w");
                    arq.close();

                    Util.exibirMensagem("Resetado com sucesso!", getTitle());

                } catch (Exception ex) {
                }
            }
        });
    }

    @Override
    public void atualizarRodape() throws Exception {
        lblUsuario.setText(Global.usuario);
        lblData.setText(Global.getDataProcessamento());
        lblVersao.setText("VERSÃO " + Global.VERSAO);
    }

    public void verificaDataBomPara() throws Exception {
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        lBPanel1 = new lbframework.bean.panel.LBPanel();
        lblUsuario = new lbframework.bean.label.LBLabel();
        lBPanel2 = new lbframework.bean.panel.LBPanel();
        lblVersao = new lbframework.bean.label.LBLabel();
        lBPanel3 = new lbframework.bean.panel.LBPanel();
        lblData = new lbframework.bean.label.LBLabel();
        lbDesktopPane = new lbframework.bean.desktopPane.LBDesktopPane();
        mnuMenu = new javax.swing.JMenuBar();
        mnuAdministracao = new javax.swing.JMenu();
        mnuAdministracaoPreco = new javax.swing.JMenuItem();
        mnuCadastro = new javax.swing.JMenu();
        mnuAcessorio = new javax.swing.JMenuItem();
        mnuBanho = new javax.swing.JMenuItem();
        mnuCadastroCliente = new javax.swing.JMenuItem();
        mnuFornecedor = new javax.swing.JMenuItem();
        mnuProduto = new javax.swing.JMenuItem();
        mnuUsuario = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        mnuFinanceiro = new javax.swing.JMenu();
        mnuContasPagar = new javax.swing.JMenu();
        mnuContasPagarLancamento = new javax.swing.JMenuItem();
        mnuCheques = new javax.swing.JMenu();
        mnuChequesRecebidos = new javax.swing.JMenuItem();
        mnuVenda = new javax.swing.JMenu();
        mnuVendaOrdemServico = new javax.swing.JMenuItem();
        mnuVendaPedido = new javax.swing.JMenuItem();
        mnuSistema = new javax.swing.JMenu();
        mnuEmail = new javax.swing.JMenuItem();
        mnuSenha = new javax.swing.JMenuItem();
        mnuSistemaLogin = new javax.swing.JMenuItem();
        mnuJanela = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new java.awt.GridBagLayout());

        lBPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        lblUsuario.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblUsuario.setText("@@@@@@");

        javax.swing.GroupLayout lBPanel1Layout = new javax.swing.GroupLayout(lBPanel1);
        lBPanel1.setLayout(lBPanel1Layout);
        lBPanel1Layout.setHorizontalGroup(
            lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblUsuario, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE)
        );
        lBPanel1Layout.setVerticalGroup(
            lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
        );

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 60.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        getContentPane().add(lBPanel1, gridBagConstraints);

        lBPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        lblVersao.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblVersao.setText("@@@@@@");

        javax.swing.GroupLayout lBPanel2Layout = new javax.swing.GroupLayout(lBPanel2);
        lBPanel2.setLayout(lBPanel2Layout);
        lBPanel2Layout.setHorizontalGroup(
            lBPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblVersao, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
        );
        lBPanel2Layout.setVerticalGroup(
            lBPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblVersao, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
        );

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 10.0;
        gridBagConstraints.insets = new java.awt.Insets(1, 2, 1, 2);
        getContentPane().add(lBPanel2, gridBagConstraints);

        lBPanel3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        lblData.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblData.setText("@@@@@@");

        javax.swing.GroupLayout lBPanel3Layout = new javax.swing.GroupLayout(lBPanel3);
        lBPanel3.setLayout(lBPanel3Layout);
        lBPanel3Layout.setHorizontalGroup(
            lBPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblData, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
        );
        lBPanel3Layout.setVerticalGroup(
            lBPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblData, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
        );

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 10.0;
        gridBagConstraints.insets = new java.awt.Insets(1, 2, 1, 0);
        getContentPane().add(lBPanel3, gridBagConstraints);

        lbDesktopPane.setBackground(new java.awt.Color(240, 240, 240));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 6;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 100.0;
        gridBagConstraints.weighty = 100.0;
        getContentPane().add(lbDesktopPane, gridBagConstraints);

        mnuMenu.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));

        mnuAdministracao.setText("Administração");

        mnuAdministracaoPreco.setText("Administração de Preço");
        mnuAdministracaoPreco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuAdministracaoPrecoActionPerformed(evt);
            }
        });
        mnuAdministracao.add(mnuAdministracaoPreco);

        mnuMenu.add(mnuAdministracao);

        mnuCadastro.setText("Cadastro");

        mnuAcessorio.setText("Acessórios");
        mnuAcessorio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuAcessorioActionPerformed(evt);
            }
        });
        mnuCadastro.add(mnuAcessorio);

        mnuBanho.setText("Banho");
        mnuBanho.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuBanhoActionPerformed(evt);
            }
        });
        mnuCadastro.add(mnuBanho);

        mnuCadastroCliente.setText("Cliente");
        mnuCadastroCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuCadastroClienteActionPerformed(evt);
            }
        });
        mnuCadastro.add(mnuCadastroCliente);

        mnuFornecedor.setText("Fornecedor");
        mnuFornecedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuFornecedorActionPerformed(evt);
            }
        });
        mnuCadastro.add(mnuFornecedor);

        mnuProduto.setText("Produtos");
        mnuProduto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuProdutoActionPerformed(evt);
            }
        });
        mnuCadastro.add(mnuProduto);

        mnuUsuario.setText("Usuário");
        mnuUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuUsuarioActionPerformed(evt);
            }
        });
        mnuCadastro.add(mnuUsuario);

        mnuMenu.add(mnuCadastro);

        jMenu2.setText("Estoque");

        jMenuItem1.setText("Acessorios");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        mnuMenu.add(jMenu2);

        mnuFinanceiro.setText("Financeiro");

        mnuContasPagar.setText("Contas à Pagar");

        mnuContasPagarLancamento.setText("Lançamento");
        mnuContasPagarLancamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuContasPagarLancamentoActionPerformed(evt);
            }
        });
        mnuContasPagar.add(mnuContasPagarLancamento);

        mnuFinanceiro.add(mnuContasPagar);

        mnuCheques.setText("Cheques");

        mnuChequesRecebidos.setText("Recebidos");
        mnuChequesRecebidos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuChequesRecebidosActionPerformed(evt);
            }
        });
        mnuCheques.add(mnuChequesRecebidos);

        mnuFinanceiro.add(mnuCheques);

        mnuMenu.add(mnuFinanceiro);

        mnuVenda.setText("Venda");

        mnuVendaOrdemServico.setText("Ordem de Serviço");
        mnuVendaOrdemServico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuVendaOrdemServicoActionPerformed(evt);
            }
        });
        mnuVenda.add(mnuVendaOrdemServico);

        mnuVendaPedido.setText("Pedido");
        mnuVendaPedido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuVendaPedidoActionPerformed(evt);
            }
        });
        mnuVenda.add(mnuVendaPedido);

        mnuMenu.add(mnuVenda);

        mnuSistema.setText("Sistema");

        mnuEmail.setText("Email");
        mnuEmail.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuEmailActionPerformed(evt);
            }
        });
        mnuSistema.add(mnuEmail);

        mnuSenha.setText("Senha");
        mnuSenha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuSenhaActionPerformed(evt);
            }
        });
        mnuSistema.add(mnuSenha);

        mnuSistemaLogin.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F12, 0));
        mnuSistemaLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lbframework/img/autenticar.png"))); // NOI18N
        mnuSistemaLogin.setText("Login");
        mnuSistemaLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuSistemaLoginActionPerformed(evt);
            }
        });
        mnuSistema.add(mnuSistemaLogin);

        mnuMenu.add(mnuSistema);

        mnuJanela.setText("Janela");
        mnuMenu.add(mnuJanela);

        setJMenuBar(mnuMenu);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnuFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuFornecedorActionPerformed
        try {
            if (formFornecedorConsulta == null || formFornecedorConsulta.isClosed()) {
                formFornecedorConsulta = new FornecedorConsultaGUI(this);
            }

            formFornecedorConsulta.setConsultaCampo(null);
            formFornecedorConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }
    }//GEN-LAST:event_mnuFornecedorActionPerformed

    private void mnuAcessorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAcessorioActionPerformed

        try {
            if (formAcessorioConsulta == null || formAcessorioConsulta.isClosed()) {
                formAcessorioConsulta = new AcessorioConsultaGUI(this);
            }

            formAcessorioConsulta.setConsultaCampo(null);
            formAcessorioConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }

    }//GEN-LAST:event_mnuAcessorioActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed

        try {
            if (formEstoqueAcessorioConsulta == null || formEstoqueAcessorioConsulta.isClosed()) {
                formEstoqueAcessorioConsulta = new EstoqueAcessorioConsultaGUI(this);
            }

            formEstoqueAcessorioConsulta.setConsultaCampo(null);
            formEstoqueAcessorioConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }



    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void mnuBanhoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuBanhoActionPerformed

        try {
            if (formBanhoConsulta == null || formBanhoConsulta.isClosed()) {
                formBanhoConsulta = new BanhoConsultaGUI(this);
            }

            formBanhoConsulta.setConsultaCampo(null);
            formBanhoConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }

    }//GEN-LAST:event_mnuBanhoActionPerformed

    private void mnuProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuProdutoActionPerformed

        try {
            if (formProdutoConsulta == null || formProdutoConsulta.isClosed()) {
                formProdutoConsulta = new ProdutoConsultaGUI(this);
            }

            formProdutoConsulta.setConsultaCampo(null);
            formProdutoConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }


    }//GEN-LAST:event_mnuProdutoActionPerformed

    private void mnuContasPagarLancamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuContasPagarLancamentoActionPerformed
        try {
            if (formContasPagarCadastro == null || formContasPagarCadastro.isClosed()) {
                formContasPagarCadastro = new ContasPagarCadastroGUI(this);
            }

            formContasPagarCadastro.setConsultaCampo(null);
            formContasPagarCadastro.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }

    }//GEN-LAST:event_mnuContasPagarLancamentoActionPerformed

    private void mnuChequesRecebidosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuChequesRecebidosActionPerformed

        try {
            if (formChequesRecebidosConsulta == null || formChequesRecebidosConsulta.isClosed()) {
                formChequesRecebidosConsulta = new ChequesRecebidosConsultaGUI(this);
            }

            formChequesRecebidosConsulta.setConsultaCampo(null);
            formChequesRecebidosConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }


    }//GEN-LAST:event_mnuChequesRecebidosActionPerformed

    private void mnuUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuUsuarioActionPerformed

        try {
            if (formUsuarioConsulta == null || formUsuarioConsulta.isClosed()) {
                formUsuarioConsulta = new UsuarioConsultaGUI(this);
            }

            formUsuarioConsulta.setConsultaCampo(null);
            formUsuarioConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }

    }//GEN-LAST:event_mnuUsuarioActionPerformed

    private void mnuSistemaLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSistemaLoginActionPerformed
        try {
            loginFrame.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }
}//GEN-LAST:event_mnuSistemaLoginActionPerformed

    private void mnuSenhaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSenhaActionPerformed

        try {
            if (formSenhaCadastro == null || formSenhaCadastro.isClosed()) {
                formSenhaCadastro = new SenhaCadastroGUI(this);
            }

            formSenhaCadastro.setConsultaCampo(null);
            formSenhaCadastro.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }


    }//GEN-LAST:event_mnuSenhaActionPerformed

    private void mnuCadastroClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCadastroClienteActionPerformed
        try {
            if (formClienteConsulta == null || formClienteConsulta.isClosed()) {
                formClienteConsulta = new ClienteConsultaGUI(this);
            }

            formClienteConsulta.setConsultaCampo(null);
            formClienteConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }
    }//GEN-LAST:event_mnuCadastroClienteActionPerformed

    private void mnuAdministracaoPrecoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAdministracaoPrecoActionPerformed
        try {
            if (formAdministracaoPreco == null || formAdministracaoPreco.isClosed()) {
                formAdministracaoPreco = new AdministracaoPrecoGUI(this);
            }

            formAdministracaoPreco.setConsultaCampo(null);
            formAdministracaoPreco.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }


    }//GEN-LAST:event_mnuAdministracaoPrecoActionPerformed

    private void mnuVendaPedidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuVendaPedidoActionPerformed
        try {
            if (formPedidoConsulta == null || formPedidoConsulta.isClosed()) {
                formPedidoConsulta = new PedidoConsultaGUI(this);
            }

            formPedidoConsulta.setConsultaCampo(null);
            formPedidoConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }
    }//GEN-LAST:event_mnuVendaPedidoActionPerformed

    private void mnuEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuEmailActionPerformed
        try {
            if (formEmailConfiguracao == null || formEmailConfiguracao.isClosed()) {
                formEmailConfiguracao = new EmailConfiguracaoGUI(this);
            }

            formEmailConfiguracao.setConsultaCampo(null);
            formEmailConfiguracao.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }
    }//GEN-LAST:event_mnuEmailActionPerformed

    private void mnuVendaOrdemServicoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuVendaOrdemServicoActionPerformed
        try {
            if (formOrdemServicoConsulta == null || formOrdemServicoConsulta.isClosed()) {
                formOrdemServicoConsulta = new OrdemServicoConsultaGUI(this);
            }

            formOrdemServicoConsulta.setConsultaCampo(null);
            formOrdemServicoConsulta.setVisible(true);

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }
    }//GEN-LAST:event_mnuVendaOrdemServicoActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuItem jMenuItem1;
    private lbframework.bean.panel.LBPanel lBPanel1;
    private lbframework.bean.panel.LBPanel lBPanel2;
    private lbframework.bean.panel.LBPanel lBPanel3;
    private lbframework.bean.desktopPane.LBDesktopPane lbDesktopPane;
    private lbframework.bean.label.LBLabel lblData;
    private lbframework.bean.label.LBLabel lblUsuario;
    private lbframework.bean.label.LBLabel lblVersao;
    private javax.swing.JMenuItem mnuAcessorio;
    private javax.swing.JMenu mnuAdministracao;
    private javax.swing.JMenuItem mnuAdministracaoPreco;
    private javax.swing.JMenuItem mnuBanho;
    private javax.swing.JMenu mnuCadastro;
    private javax.swing.JMenuItem mnuCadastroCliente;
    private javax.swing.JMenu mnuCheques;
    private javax.swing.JMenuItem mnuChequesRecebidos;
    private javax.swing.JMenu mnuContasPagar;
    private javax.swing.JMenuItem mnuContasPagarLancamento;
    private javax.swing.JMenuItem mnuEmail;
    private javax.swing.JMenu mnuFinanceiro;
    private javax.swing.JMenuItem mnuFornecedor;
    public javax.swing.JMenu mnuJanela;
    private javax.swing.JMenuBar mnuMenu;
    private javax.swing.JMenuItem mnuProduto;
    private javax.swing.JMenuItem mnuSenha;
    private javax.swing.JMenu mnuSistema;
    private javax.swing.JMenuItem mnuSistemaLogin;
    private javax.swing.JMenuItem mnuUsuario;
    private javax.swing.JMenu mnuVenda;
    private javax.swing.JMenuItem mnuVendaOrdemServico;
    private javax.swing.JMenuItem mnuVendaPedido;
    // End of variables declaration//GEN-END:variables
}
